package com.atguigu.a_calendar;

import java.util.Calendar;
import java.util.Date;

public class Test1 {
    public static void main(String[] args) {
        //获取当前时间毫秒值
        long now = System.currentTimeMillis();

        //获取出生日期的Calendar对象
        Calendar instance = Calendar.getInstance();

        //设置日历对象指向的时间
        instance.set(1991,Calendar.JANUARY,1,0,0,0);

        //Calendar --> Date
        Date birthDate = instance.getTime();

        //Date --> long
        long birthDateTime = birthDate.getTime();

        long days = (now - birthDateTime) / (1000 * 60 * 60 * 24);
        System.out.println("days = " + days);
    }
}
